#!/bin/bash

if [ $# -lt 1 ]; then
  echo "$0 <pkg>"
  exit 1
fi

pkg=$1

./bi.sh ${pkg} | xmlstarlet sel -t -v "/buildinfo/error" | grep -Eo 'nothing provides [^,]+[, ]' \
| sed -r 's@^nothing provides ([^ ]+)[, ].*@\1@' \
| sort -u | while read i; do ./prov.sh 22.03.repo "$i" 2>/dev/null; done
